<?php /*a:1:{s:45:"D:\phpstudy\WWW\tp6\view\admin\role\edit.html";i:1577506534;}*/ ?>

<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-block">
            <input class="layui-input" type="text" name="name" placeholder="请输入角色名称" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择权限</label>
        <div class="layui-input-block">
            <div id="LAY-auth-tree-index"></div>
        </div>
    </div>
</form>
<script>
    layui.use([ 'form',  'authtree'], function() {
        var authtree = layui.authtree;
        var form = layui.form;
        // var trees= JsGet("<?php echo url('role/getTree'); ?>", function(e){
        var id=<?php echo htmlentities($id); ?>;
        //console.log(tress);
        JsGet("<?php echo url('role/getTree'); ?>?id="+id, function(e) {
            e=JSON.parse(e);
            var trees = authtree.listConvert(e.list, {
                primaryKey: 'id'
                ,startPid: 0
                ,parentKey: 'pid'
                ,nameKey: 'title'
                ,valueKey: 'id'
                ,checkedKey: e.checkedId
            });
            console.log(trees);
            authtree.render('#LAY-auth-tree-index', trees, {
                inputname: 'authids[]',
                layfilter: 'lay-check-auth',
                theme: 'auth-skin-default',
                autowidth: true,
            });
        });
    })



</script>